<template>
	<view>
		<passwordc title="请输入旧的密码" @huitiao="setertya" v-if="buzou==0"></passwordc>
		<passwordc title="设置新的锁屏密码" @huitiao="setertyb" v-if="buzou==1"></passwordc>
		<passwordc title="再次确认密码" @huitiao="setertyc" v-if="buzou==2"></passwordc>
	</view> 
</template>
<script> 
	import passwordc from './components/passwordc.vue'
	export default {
		data() {
			return {
				buzou: 0, // 0旧的密码 1.设置新的锁屏密码 2.再次确认密码
				jhjhdsfa: '', // 旧的密码 的值
				jhjhdsfb: '', // 新的锁屏密码 的值
				jhjhdsfc: '' // 确认密码 的值
			}
		},
		components: {
			passwordc
		},
		methods: {
			kjnsety(e) {
				this.inns = e.detail.value.length
			},
			setertya(e) {
				this.buzou = 1
				this.jhjhdsfa = e
			},
			setertyb(e) {
				this.buzou = 2
				this.jhjhdsfb = e
			},
			setertyc(e) {
				this.jhjhdsfc = e
				if (this.jhjhdsfb != this.jhjhdsfc) {
					this.buzou = 1
					uni.showToast({
						icon:"none",
						title:'两次密码输入不一致'
					})
					return
				}
				this.dengljse()
			},
			async dengljse() {
				let cs = {}
				cs.old_password = this.jhjhdsfa
				cs.password = this.jhjhdsfb
				cs.password_confirmation = this.jhjhdsfc
				// let jhsd = await this.post("/api/lock/password"  , cs)
				uni.showToast({
					title:'密码解锁已开启'
				})
					let locks = {type:1,vaule:this.jhjhdsfb}
					uni.setStorageSync('locks',locks)
				setTimeout(function(){
					uni.navigateBack({
						delta:2
					})
				},2000)
				
			}
		},
		mounted() {

		}
	}
</script>
<style scoped>

</style>
